package com.cy.yqyquestion;

import com.cy.yqyquestion.demos.web.vo.ContextBean;
import com.yomahub.liteflow.core.FlowExecutor;
import com.yomahub.liteflow.flow.LiteflowResponse;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.HashMap;

/**
 * @Author 朝闻道
 * @Date 2024年04月01日 15:50
 * @Description
 */
@Component
public class ChainExecute implements CommandLineRunner {

    @Resource
    private FlowExecutor flowExecutor;

    /*
     * @Description: 启动一个流程 测试
     * @Param: [args]
     * @return: void
     */
    @Override
    public void run(String... args) throws Exception {


        HashMap<String, String> originParams = new HashMap<>();
        originParams.put("user", "王晨");
        originParams.put("purchase", "固态硬盘");
        originParams.put("price", "300");



        //启动一个流程
        LiteflowResponse liteflowResponse = flowExecutor.execute2Resp("procurement", originParams, ContextBean.class);  // 这里就开始执行流程



    }
}
